#!/usr/bin/env bash
base_path=~/docker/ELK/logstash
container_name=elk-logstash
port1=5044
port2=9600
script_pwd=$(dirname "$0")

rm -rf $base_path/config
rm -rf $base_path/pipline

mkdir -p $base_path/data
mkdir -p $base_path/logs

cp -r $script_pwd/config $base_path/.
cp -r $script_pwd/pipeline $base_path/.

docker rm -f $container_name

docker run -itd \
--name $container_name \
-e TZ=Asia/Shanghai \
-p $port1:5044 \
-p $port2:9600 \
-v $base_path/config:/usr/share/logstash/config \
-v $base_path/pipeline:/usr/share/logstash/pipeline \
-v $base_path/data:/usr/share/logstash/data \
-v $base_path/logs:/usr/share/logstash/logs \
docker.elastic.co/logstash/logstash:8.16.1
